package com.maxd.respository.helpTask;

import com.maxd.model.HelpMaintain;
import com.maxd.model.HelpMaintainModel;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

public interface HelpMaintainModelRepository extends Repository<HelpMaintainModel, Long> {


    @Query(value = "select m.id, t.id as help_task_id,t.title,t.task_price ,m.help_send_order_id,t.label,m.create_time,m.state,m.content from help_maintain m " +
            "left join help_task t on t.id=m.help_task_id " +
            " group by m.id order by m.create_time desc",
            countQuery="select count(*) from help_maintain m " +
                    "left join help_task t on t.id=m.help_task_id " +
                    " group by m.id order by m.create_time desc",
            nativeQuery = true)
    Page<HelpMaintainModel> selectHelpMaintainList(Pageable pageable);

}
